<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
        <iframe id="ifr" src="b.com/index.html"></iframe>
        <script type="text/javascript">
        window.onload = function() {
            var ifr = document.getElementById('ifr');
            var targetOrigin = 'http://b.com'; 
            ifr.contentWindow.postMessage('I was there!', targetOrigin);
        };
        </script>
</body>
</html>